import React, {Component} from 'react';
import theme from "../../theme";
import ThemesContext from "./theme-context";
import ThemeButton from "./theme-button";

class ThemeIndex extends Component {

    state ={
        themes:theme.light,
    }


    toggleTheme = ()=>{
        console.log(1111)
        this.setState(state =>({
            themes: state.themes === theme.light?  theme.dark:theme.light
        }))
    }


    render() {
        return (
            <div>
                <ThemesContext.Provider value={{themes: this.state.themes,toggleTheme:this.toggleTheme}}>
                     <ThemeButton/>
                </ThemesContext.Provider>
            </div>
        );
    }
}

export default ThemeIndex;


